/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Zona")
@NamedQueries({
    @NamedQuery(name = "Zona.findAll", query = "SELECT z FROM Zona z"),
    @NamedQuery(name = "Zona.findByIdZona", query = "SELECT z FROM Zona z WHERE z.idZona = :idZona"),
    @NamedQuery(name = "Zona.findByNombre", query = "SELECT z FROM Zona z WHERE z.nombre = :nombre"),
    @NamedQuery(name = "Zona.findByDescripcion", query = "SELECT z FROM Zona z WHERE z.descripcion = :descripcion"),
    @NamedQuery(name = "Zona.findByPiso", query = "SELECT z FROM Zona z WHERE z.piso = :piso"),
    @NamedQuery(name = "Zona.findByEstado", query = "SELECT z FROM Zona z WHERE z.estado = :estado")})
public class Zona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdZona")
    private Integer idZona;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Size(max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    @Column(name = "Piso")
    private Integer piso;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idZona", fetch = FetchType.LAZY)
    private List<Estante> estanteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idZona", fetch = FetchType.LAZY)
    private List<Cubiculo> cubiculoList;
    @JoinColumn(name = "IdLocal", referencedColumnName = "IdLocal")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Local idLocal;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idZona", fetch = FetchType.LAZY)
    private List<InfraestructuraFisica> infraestructuraFisicaList;

    public Zona() {
    }

    public Zona(Integer idZona) {
        this.idZona = idZona;
    }

    public Integer getIdZona() {
        return idZona;
    }

    public void setIdZona(Integer idZona) {
        this.idZona = idZona;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Integer getPiso() {
        return piso;
    }

    public void setPiso(Integer piso) {
        this.piso = piso;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<Estante> getEstanteList() {
        return estanteList;
    }

    public void setEstanteList(List<Estante> estanteList) {
        this.estanteList = estanteList;
    }

    public List<Cubiculo> getCubiculoList() {
        return cubiculoList;
    }

    public void setCubiculoList(List<Cubiculo> cubiculoList) {
        this.cubiculoList = cubiculoList;
    }

    public Local getIdLocal() {
        return idLocal;
    }

    public void setIdLocal(Local idLocal) {
        this.idLocal = idLocal;
    }

    public List<InfraestructuraFisica> getInfraestructuraFisicaList() {
        return infraestructuraFisicaList;
    }

    public void setInfraestructuraFisicaList(List<InfraestructuraFisica> infraestructuraFisicaList) {
        this.infraestructuraFisicaList = infraestructuraFisicaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idZona != null ? idZona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zona)) {
            return false;
        }
        Zona other = (Zona) object;
        if ((this.idZona == null && other.idZona != null) || (this.idZona != null && !this.idZona.equals(other.idZona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Zona[ idZona=" + idZona + " ]";
    }
    
}
